import { childrenProps } from "@/components/ProForm/interface";

export const getStatusName = (arr: childrenProps[], status) => {
  return arr.find(item => item.value + "" === status + "")?.text || "--";
};

export const getStatusNameAndType = (arr: childrenProps[], status) => {
  const statusObj = arr.find(item => item.value + "" === status + "");
  const { text, tag } = statusObj || {};
  return {
    statusName: text,
    statusType: tag
  };
};

/**
 * @description：是否合并报工
 */
export const status1: childrenProps[] = [
  {
    text: "合并报工",
    value: "1"
  },
  {
    text: "不合并报工",
    value: "0"
  }
];

/**
 * @description：是否使用
 */
export const status2: childrenProps[] = [
  {
    text: "是",
    value: "1"
  },
  {
    text: "否",
    value: "0"
  },
  {
    text: "全部",
    value: ""
  }
];

/**
 * @description：已使用 | 未使用
 */
export const status3: childrenProps[] = [
  {
    text: "已使用",
    value: "1",
    tag: "warning-box"
  },
  {
    text: "未使用",
    value: "0",
    tag: "success-box"
  }
];

/**
 * @description： 保存 | 提交
 */
export const status4: childrenProps[] = [
  {
    text: "保存",
    value: "0",
    tag: "warning-box"
  },
  {
    text: "提交",
    value: "1",
    tag: "success-box"
  }
];
